﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

namespace Util
{
    public class Funcs
    {
        public static string GetIpClient()
        {
            string strIP = string.Empty;
            try
            {
                string strHostName = string.Empty;
                // Getting Ip address of local machine...
                // First get the host name of local machine.
                strHostName = Dns.GetHostName();
                // Then using host name, get the IP address list..
                IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);
                IPAddress[] addr = ipEntry.AddressList;

                if (addr.Length > 3)
                {
                    strIP = addr[2].ToString();
                }
            }
            catch { }
            return strIP;
        }
    }
}
